package com.deyuan.service;

import com.deyuan.bean.Student;
import com.deyuan.bean.StudentVo;
import com.deyuan.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class StudentService {
    @Autowired
    private StudentMapper studentMapper;
    public Student queryById(int id){
       return  studentMapper.queryById(id);
    }

    public int add(Student student){
        return studentMapper.add(student);
    }

    public List<Student> queryAll(){
        return studentMapper.queryAll();
    }

    public void delete(StudentVo studentVo){
        studentMapper.delete(studentVo);
    }

    public List<Student> queryByName(String name){
        return studentMapper.queryByName("%"+name+"%");
    }

    public void update(Student student){
       studentMapper.update(student);
    }
}
